package xhwl.insurance.http.api;

import com.google.gson.Gson;

import okhttp3.RequestBody;
import rx.Observable;
import xhwl.android.common.util.SPUtil;
import xhwl.insurance.http.ApiService;
import xhwl.retrofitrx.BaseApi;

/**
 * Created by admin on 2017/6/6.
 */

public class GetOrderApi extends BaseApi {

    GetOrderApiReq req;
    public GetOrderApi(String person_name, String person_mobile,
                       String person_idcard, String person_age,String person_sex,
                       String sale_userid, String sale_mobile,
                       String sale_type, String hz_money, String yw_id) {
        req = new GetOrderApiReq(person_name, person_mobile, person_idcard, person_age, person_sex, sale_userid, sale_mobile, sale_type, hz_money, yw_id);
    }

    @Override
    protected Observable getObservable() {
        RequestBody requestBody = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(req));
        return retrofit.create(ApiService.class).getOrder(requestBody);
    }

    public class GetOrderApiReq {

        /**
         * person_name : xx
         * person_mobile : 13121829476
         * person_sex
         * person_idcard : xxx
         * person_age : 18
         * yw_id : 2
         * sale_userid : xx
         * sale_mobile : xx
         * sale_type : 2
         * hz_money : 200
         */

        private String person_name;
        private String person_mobile;
        private String person_idcard;
        private String person_age;
        private String yw_id;
        private String sale_userid;
        private String sale_mobile;
        private String sale_type;
        private String hz_money;
        private String person_sex;
        private String member_mobile;

        public GetOrderApiReq(String person_name, String person_mobile,
                              String person_idcard, String person_age,String person_sex,
                              String sale_userid, String sale_mobile,
                              String sale_type, String hz_money, String yw_id) {
            this.person_name = person_name;
            this.person_mobile = person_mobile;
            this.person_idcard = person_idcard;
            this.person_age = person_age;
            this.person_sex=person_sex;
            this.yw_id = yw_id;
            this.sale_userid = sale_userid;
            this.sale_mobile = sale_mobile;
            this.sale_type = sale_type;
            this.hz_money = hz_money;
            this.member_mobile=SPUtil.getPersonInfoSp().getString(SPUtil.SPPersonInfo.LINK_MOBILE,"");
        }
    }
}
